package com.d6game.purchase;

import java.util.List;

import com.d6game.purchase.model.Color;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ColorAdapter extends BaseAdapter {
	private Context context;
	private List<Color> list;

	public ColorAdapter(Context context, List<Color> list){
		this.context = context;
		this.list = list;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		 LayoutInflater _LayoutInflater=LayoutInflater.from(context);
		 convertView=_LayoutInflater.inflate(R.layout.color_spinner, null);
         if(convertView!=null)
         {
             TextView shop_id = (TextView)convertView.findViewById(R.id.textView_color_spiner_id);
             TextView shop_nameTextView = (TextView)convertView.findViewById(R.id.textView_color_spiner_name);
             shop_id.setText(list.get(position).getId());
             shop_nameTextView.setText(list.get(position).getName());
         }
         return convertView;

	}

}
